Skip to content

feat(tracing): add generated metadata spans - #3269

Draft
james-elicx wants to merge 1 commit into
codex/otel-03b-request-stream-lifetimefrom
codex/otel-05c-metadata-spans
Draft

james-elicx wants to merge 1 commit into
codex/otel-03b-request-stream-lifetimefrom
codex/otel-05c-metadata-spans

Conversation

@james-elicx

Copy link
Copy Markdown
Member

Summary

  • emit Next.js-compatible ResolveMetadata.generateMetadata spans through the shared framework tracer
  • preserve exact module identities for pages, layouts, nested parallel slots, intercepts, and HTTP-access fallback conventions
  • move App Page element preparation inside AppRender.getBodyResult so generated metadata and application child spans have the same parent as Next.js
  • prove the hierarchy with an unchanged real @sentry/nextjs integration on Workerd

Next.js parity

Pinned against vercel/next.js@b421cadefd31c1b59d117842021ded7c1ebaf5b4, especially:

  • packages/next/src/lib/metadata/metadata-resolution-primitives.ts
  • packages/next/src/lib/metadata/resolve-metadata.ts
  • packages/next/src/server/app-render/app-render.tsx
  • test/e2e/opentelemetry/instrumentation/opentelemetry.test.ts

The trace route excludes parallel-slot directory keys, retains route groups/interception segments, and uses not-found, forbidden, or unauthorized plus the owning module route. Static metadata exports remain untraced.

No OpenTelemetry package is added as a required vinext dependency, and no Sentry-specific runtime path is introduced. The same descriptors flow to Workers tracing automatically.

Validation

  • vp check
  • focused metadata/render/head/boundary suites (270 passed)
  • vp run vinext#build
  • PLAYWRIGHT_PROJECT=cloudflare-sentry-app pnpm run test:e2e (17 passed)
  • independent correctness review: clean after addressing active/inactive nested slot route identity without changing behavioral metadata routes
  • independent Next.js parity review: clean after addressing fallback convention, owner route, and @slot identity findings

Stack parent: #3268

@james-elicx
james-elicx added this pull request to stack #3258 September 15, 2026 02:43
@pkg-pr-new

pkg-pr-new Bot commented Sep 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/cloudflare/vinext/@vinext/cloudflare@3269

create-vinext-app

npm i https://pkg.pr.new/cloudflare/vinext/create-vinext-app@3269

@vinext/types

npm i https://pkg.pr.new/cloudflare/vinext/@vinext/types@3269

vinext

npm i https://pkg.pr.new/cloudflare/vinext@3269

@cloudflare/workers-response-store

npm i https://pkg.pr.new/cloudflare/vinext/@cloudflare/workers-response-store@3269

commit: 098e10a

@james-elicx
james-elicx force-pushed the codex/otel-05c-metadata-spans branch from f9b0651 to 098e10a Compare September 15, 2026 02:45
@github-actions

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
response-store-demo preview production
static-export preview production
web preview production

@github-actions

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 098e10a against base b697924 using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.3 KB 142.3 KB ⚫ -0.0%
Client entry size (gzip) vinext 129.7 KB 129.7 KB ⚫ -0.0%
Dev server cold start vinext 2.52 s 2.51 s ⚫ -0.4%
Production build time vinext 2.77 s 2.78 s ⚫ +0.2%
RSC entry closure size (gzip) vinext 124.5 KB 125.0 KB ⚫ +0.4%
Server bundle size (gzip) vinext 215.1 KB 215.7 KB ⚫ +0.3%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@james-elicx
james-elicx removed this pull request from stack #3258 September 15, 2026 06:40
@james-elicx
james-elicx added this pull request to stack #3285 September 15, 2026 06:40
@james-elicx
james-elicx removed this pull request from stack #3285 September 15, 2026 06:59
@james-elicx
james-elicx added this pull request to stack #3287 September 15, 2026 06:59
@james-elicx
james-elicx removed this pull request from stack #3287 September 15, 2026 13:50
@james-elicx
james-elicx added this pull request to stack #3298 September 15, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant